package vista;

import java.awt.Graphics;
import java.awt.Image;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;

import javax.imageio.ImageIO;
import javax.swing.JPanel;

class ImagePanel extends JPanel {  

	private static final long serialVersionUID = 1L;
			
	private Image image;  
	   
	public ImagePanel(String imageName) {
		BufferedImage img = null;
		try {
		    img = ImageIO.read(new File(imageName));
		} catch (IOException e) {
		}

		this.image = img;  
	}  
	   
	@Override  
	public void paintComponent(Graphics g) {  
		super.paintComponent(g);  
		
		if (image != null){  
			g.drawImage(image, 0, 0, this);  
		}  
	}
}
